feat(hooks): add local extension points via config/hooks lifecycle hooks and bin-local - #531
julius-retzer wants to merge 20 commits into
Conversation
b542b0c to
7fabefc
Compare
|
Thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#531 at |
7fabefc to
d36a9ef
Compare
Done |
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#531 at |
…local/) Adds a shared best-effort hook runner (bin/fm-hooks-lib.sh) and four gitignored-local lifecycle hook points: post-spawn, pr-ready, post-merge, and post-teardown, plus a bin-local/ home dir for personal helper scripts. Absent hooks are silent no-ops; failing or hanging hooks warn and never block the calling flow. docs/extension-points.md owns the contract. Convention-compatible with PR kunchenguid#371's post-worktree-create seam (same config/hooks/ dir, runner semantics, FM_HOOK_TIMEOUT, args+env mirroring).
…cuous hook env assertions"}
…ist unbounded branch
…; fix watchdog budget race
… byte-cap hook stderr
…r an explicit flag
d36a9ef to
b8277d1
Compare
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#531 at |
Re-review after the fix round — verdict: approveReviewed 1. Hindi-scan guard — fixed. On the exact ask, "a test that fails if a call site could route a Hindi scan to Claude": no Anthropic call site exists ( Residual, not blocking: the proof is caller-asserted and unvalidated — 2. Retry cap — fixed. 3. CI: 5 passed, 0 failed, 1 pending (Vercel deploy). Wiki freshness green. Still open (not this round's scope): items 4–8 from the first review. Worth a follow-up issue — especially #4 (lint rule escapable via template literal and Full report: |
What Changed
bin/fm-hooks-lib.sh, a bash-3.2-compatible library that fires lifecycle hooks fromconfig/hooks/, and wired hook points intofm-spawn.sh,fm-teardown.sh,fm-pr-check.sh,fm-pr-merge.sh, and the newfm-merge-local.sh; hooks run last, get detached/byte-capped stdio, and are bounded by a shell watchdog (with process-group kill) whentimeoutis absent.bin-local/as an overlay for local scripts (gitignored, preserved byupdatefirstmate), and gated thepr-readymarker behind an installed hook so it fires once via a durable meta marker after merge.docs/extension-points.md,docs/configuration.md,docs/architecture.md,README.md,AGENTS.md, andCONTRIBUTING.md, and addedtests/fm-hooks-lib.test.sh,tests/fm-bash32.test.sh, plus teardown/lifecycle test coverage.Risk Assessment
✅ Low: Purely additive, gitignored, ships-no-hooks feature that is a no-op by default; the runner is defensively correct and the non-hook refactors are semantics-preserving.
Testing
Completed 1 recorded test check.
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
🔧 **Rebase** - 4 issues found → auto-fixed ✅
AGENTS.md- merge conflict rebasing onto origin/mainbin/fm-pr-check.sh- merge conflict rebasing onto origin/mainbin/fm-pr-merge.sh- merge conflict rebasing onto origin/maindocs/scripts.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
bin/fm-hooks-lib.sh:284- fm_hook_run unconditionally grabs fds 6/7/8/9 (exec 7>... 9<... 8<>... 6<...) and releases them by closing, not by save/restore. The same scripts source fm-pr-lib.sh (uses fd 8) and, on the check path, fm-check-lib.sh (uses fd 9). Those uses are transient inside their own functions and don't overlap the end-of-script hook calls, so all current callers are safe. But this is a shared library meant to be sourced widely; a future caller that invokes fm_hook_run while holding fd 6-9 open (a lock fd, an open read loop) would have it silently closed. Worth a header note pinning the fd range as reserved.command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.